package com.wanmait.wisdom.manage.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wanmait.wisdom.entity.Admin;
import com.wanmait.wisdom.util.AjaxResult;
import com.wanmait.wisdom.util.JWTUtils;
import com.wanmait.wisdom.manage.service.ManageAdminService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class ManageAdminController
{
    @Resource
    private ManageAdminService adminService;

//    @Value("token.expireMinutes")
//    private int expireMinutes;


    @PostMapping("/manage/login")
    public AjaxResult login(@RequestBody Admin admin) { return adminService.Login(admin); }

    @GetMapping("/manage/list")
    public AjaxResult findAll(){ return  adminService.findAll();}

    @PostMapping("/manage/addadminchangepassword")
    public AjaxResult AddAdmin(@RequestBody Admin admin) {return adminService.AddadminChangepassword(admin); }
    @GetMapping("/manage/adminpagelist")
    public AjaxResult AdminPageList(Integer pageNum,Integer pageSize){return adminService.listPage(pageNum,pageSize);}
    @PostMapping("/manage/checkname")
    public AjaxResult checkName(@RequestBody Admin admin){;return adminService.checkName(admin);}
    @GetMapping("/manage/getid")
    public  AjaxResult getAdminid(String id){Integer.parseInt(id);return adminService.getAdminid(id);}
    @PostMapping("/manage/deleteAdmin")
    public AjaxResult deleteAdmin(@RequestBody Admin admin){
    return adminService.admindelete(admin);
    }

}
